﻿Public Class Lyricfrm

    Public Shared RichtxtLyric As New RichTextBox

    Private Sub Lyricfrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Panel1.Controls.Remove(RichtxtLyric)
        RichtxtLyric = New RichTextBox
        RichtxtLyric.BackColor = System.Drawing.Color.FromArgb(CType(CType(17, Byte), Integer), CType(CType(17, Byte), Integer), CType(CType(17, Byte), Integer))
        RichtxtLyric.BorderStyle = System.Windows.Forms.BorderStyle.None
        RichtxtLyric.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        RichtxtLyric.ForeColor = System.Drawing.Color.Gray
        RichtxtLyric.Location = New System.Drawing.Point(27, 0)
        RichtxtLyric.Name = "RichtxtLyric"
        RichtxtLyric.Size = New System.Drawing.Size(448, 223)
        RichtxtLyric.TabIndex = 0
        RichtxtLyric.Text = ""
        If Not Betafrm.f Is Nothing Then
            If Betafrm.f.Lyric <> "" Then
                RichtxtLyric.Text = Environment.NewLine + Betafrm.f.Lyric + Environment.NewLine
            Else
                RichtxtLyric.Text = Environment.NewLine + "Không có lời bài hát "
            End If
        End If

        Panel1.Controls.Add(RichtxtLyric)
    End Sub

    Private Sub Lyricfrm_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Betafrm.m_LyricfrmShow = False
    End Sub

    Private Sub Betafrm_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        Dim w_pen As Single = 3
        Dim p As New Pen(Color.FromArgb(51, 51, 51), w_pen)
        e.Graphics.DrawRectangle(p, New Rectangle(1, 1, Width - w_pen, Height - w_pen))
        SetStyle(ControlStyles.UserPaint, True)
        SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
        SetStyle(ControlStyles.SupportsTransparentBackColor, True)
        Me.BackColor = Color.LimeGreen
        Me.TransparencyKey = BackColor
    End Sub

    'Đổ bóng form
    Private Const CS_DROPSHADOW As Integer = 131072
    Protected Overrides ReadOnly Property CreateParams As System.Windows.Forms.CreateParams
        Get
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ClassStyle = cp.ClassStyle Or CS_DROPSHADOW
            Return cp
        End Get
    End Property

    'Di duyển form
    Private MouseIsDown As Boolean = False
    Private MouseIsDownLoc As Point = Nothing
    Private Sub Betafrm_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
        If e.Button = MouseButtons.Left Then
            If MouseIsDown = False Then
                MouseIsDown = True
                MouseIsDownLoc = New Point(e.X, e.Y)
            End If
            Me.Location = New Point(Me.Location.X + e.X - MouseIsDownLoc.X, Me.Location.Y + e.Y - MouseIsDownLoc.Y)
            Application.DoEvents()
        End If
    End Sub
    Private Sub Betafrm_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
        MouseIsDown = False
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Close()
    End Sub
End Class